package com.ctbri.io;

import java.io.File;
import java.io.IOException;

import com.ctbri.util.BinaryFile;
import com.ctbri.util.Directory;
import com.ctbri.util.Directory.TreeInfo;

public class Ex20 {
	
	public static void main(String[] args) throws IOException {
		TreeInfo info = Directory.walk("D:/Java/workspace/thinkinginjava/bin");
		for(File file : info.files) {
			byte[] contents = BinaryFile.read(file);
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < 4; i++) {
				sb.append(Integer.toHexString(contents[i] & 0xFF).toUpperCase());
			}
			System.out.println(sb.toString());
		}
	}
}
